using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Dynamic;
using YTS.Tools;

namespace Test.ConsoleProgram.Algorithm.Solution
{
    [TestDescription("算法: 1431. 拥有最多糖果的孩子")]
    public class No1431_KidsWithCandies : AbsBaseTestItem
    {
        public override void OnTest()
        {
            Assert.TestExe(KidsWithCandies, new int[] { 2, 3, 5, 1, 3 }, 3, new bool[] { true, true, true, false, true });
            Assert.TestExe(KidsWithCandies, new int[] { 4, 2, 1, 1, 2 }, 1, new bool[] { true, false, false, false, false });
            Assert.TestExe(KidsWithCandies, new int[] { 12, 1, 12 }, 10, new bool[] { true, false, true });
        }

        public IList<bool> KidsWithCandies(int[] candies, int extraCandies)
        {
            int max = 0;
            for (int i = 0; i < candies.Length; i++)
            {
                max = Math.Max(max, candies[i]);
            }
            List<bool> result = new List<bool>();
            for (int i = 0; i < candies.Length; i++)
            {
                result.Add(candies[i] + extraCandies >= max);
            }
            return result;
        }
    }
}
